package service

import (
	"choujiang/common/models"
	"choujiang/common/db"
	"fmt"
	"choujiang/common/utils"
)

func GetAdvertList(aPosition int64) []model.Advertisement {
	advert := make([]model.Advertisement, 0)
	err := db.MysqlEngine.Where("status=? and position=?", 1, aPosition).Desc("order").Find(&advert)
	if err != nil {
		fmt.Printf("GetRecommendList err:%+v\n", err)
	}
	for i := 0; i < len(advert); i++ {
		advert[i].Cover = utils.AddPrefix(advert[i].Cover)
	}
	return advert
}
